﻿using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.BHGPSSP.Dtos;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.BHGPSSP
{
    /// <summary>
    /// 不合格评审审批接口
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/BHGPSSP")]
    public class BHGPSSPController : BPMReportPlatformController

    {
        private readonly IBHGPSSPService _bhgpsspService;

        public BHGPSSPController(IBHGPSSPService bhgpsspService)
        {
            _bhgpsspService = bhgpsspService;
        }

        /// <summary>
        /// 见单生产查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("GetAllAsync")]
        public async Task<PagedResultDto<GetBHGPSSPOutput>> GetAllAsync([FromBody] GetBHGPSSPInput input)
        {
            return await _bhgpsspService.GetAllAsync(input);
        }

        /// <summary>
        /// 见单生产导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ExportAsync")]
        public async Task<XlsxFileResult<GetBHGPSSPOutput>> ExportAsync([FromBody] GetBHGPSSPInput input)
        {
            var rst = await _bhgpsspService.ExportAsync(input);
            return new XlsxFileResult<GetBHGPSSPOutput>(rst, "导出Excel");
        }

        /// <summary>
        /// 新不合格评审审批 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("NewBHGPSSP/GetAllAsync")]
        public async Task<PagedResultDto<NewBHGPSSPOutput>> GetAllAsync([FromBody] GetNewBHGPSSPInput input)
        {
            return await _bhgpsspService.GetAllAsync(input);
        }

        /// <summary>
        /// 新不合格评审审批 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("NewBHGPSSP/ExportAsync")]
        public async Task<XlsxFileResult<NewBHGPSSPOutput>> ExportAsync([FromBody] GetNewBHGPSSPInput input)
        {
            var rst = await _bhgpsspService.ExportAsync(input);
            return new XlsxFileResult<NewBHGPSSPOutput>(rst, "导出Excel");
        }
    }
}